<!DOCTYPE htm PUBLIC "-//W3C//DTD Xhtm 1.0 Transitional//EN" "DTD/xhtm1-transitional.dtd"> 
<htm xmlns="http://www.w3.org/1999/xhtm" xml:lang="de" lang="de">
<head>
 <meta http-equiv="content-type" content="text/htm; charset=iso-8859-1" />
 <meta http-equiv="content-style-type" content="text/css" />
 <meta name="author" content="Arlsair" />
 <meta name="date" content="2004-01-22" />
 <title>MPEG2Dec3</title>
 <link rel="stylesheet" type="text/css" href="../../style.css" />
</head><body>
<h1>MPEG2Dec3</h1>

<h2>&Uuml;bersicht</h2>
<b>Autor:</b> MarcFD, Nic, trbarry, Sh0dan und andere<br />
<b>Version:</b> 1.10<br />
<b>Download:</b> <a href="http://www.avisynth.org/warpenterprises/" target="_blank">http://www.avisynth.org/warpenterprises/</a><br />
<b>Kategorie:</b> MPEG Dekoder<br />
<b>Anforderungen:</b> keine<br />
<hr>
<h2>Description</h2>
This filter is able to output in the RGB, YUY2 and YV12 colorformats.<br>
It is a MPEG-2 decoder and it is able to decode any MPEG-2 streams readable by
dvd2avi 1.76 / 1.77.3 / 1.83x (and others). It also supports hdtv stream,
although you need <a href="http://www.trbarry.com/DVD2AVIT3.zip">dvd2avi 1.83.5</a>
for this. (This is a modified version of MPEG2Dec2 from save-oe (smart audio video encoder).)<br>
Additional features are (for example): YV12, YUY2 and RGB32 output (although it is
recommended to use AviSynth's color conversion routines), interlacing control,
integrated PostProcessing, Luminance Filtering, etc.<br>
<h2>Examples Usage of MPEG2Dec3 package filters:</h2>
<ul>
	(all the avisynth script lines here are only exemples)<br>
	First, add the following line in your .avs script :<br>
	<code><br>
	LoadPlugin("MPEG2Dec3.dll") # because Avisynth 2.5 didn't support Autoloading yet<br>
	</code><br>
	
	<h3>Basic MPEG2Dec3 usage :</h3>
	<ul>
		To do plain YV12 decoding.<br>
		<code><br>
		MPEG2Source("dvd.d2v")<br>
		</code><br>
		To use Post Processing : here, deblocking only.<br>
		<code><br>
		MPEG2Source("dvd.d2v",cpu=4) <br>
		</code><br>
		it's better to use Field Based Post Processing for interlaced sources.<br>
		<code><br>
		MPEG2Source("dvd.d2v",cpu=4,iPP=true)<br>
		</code><br>
		if you have a intel Pentium 4 cpu, you can force sse2 idct.<br>
		<code><br>
		MPEG2Source("dvd.d2v",idct=5) <br>
		</code><br>
		To use custom post processing setting : only deringing here.<br>
		<code><br>
		MPEG2Source("dvd.d2v",cpu2="ooooxx") 
		</code><br>
	</ul>
	<h3>Colorspace convertions :</h3>
	<ul>
		To convert to YUY2.<br>
		<code><br>
		MPEG2Source("dvd.d2v")<br>
		YV12toYUY2()<br>
		</code><br>
		To convert to YUY2 a progressive source.<br>
		<code><br>
		MPEG2Source("dvd.d2v")<br>
		YV12toYUY2(interlaced=false)<br>
		</code><br>
		To convert to RGB24.<br>
		<code><br>
		MPEG2Source("dvd.d2v")<br>
		YV12toRGB24()<br>
		FlipVertical() #YV12->BGR24 convertion natively flips image<br>
		</code><br>
		To convert to RGB24 a progressive source.<br>
		<code><br>
		MPEG2Source("dvd.d2v")<br>
		YV12toRGB24(interlaced=false)<br>
		FlipVertical() #YV12->BGR24 convertion natively flips image<br>
		</code><br>
	</ul>
	<h3>Usefull additionnal YV12 Filters :</h3>
	<ul>
		To Darken Luminosity.<br>
		<code><br>
		LumaFilter(-10,0.9)<br>
		</code><br>
		To Ligthen Luminosity.<br>
		<code><br>
		LumaFilter(+10,1.1)<br>
		</code><br>
		Of course you can tweak the settings how you want.<br>
		See the Syntax part for more information about it.<br>
		<br>
	</ul>
</ul>
<h2>Syntax of MPEG2Dec3 package filters :</h2>
<ul>
	<h3>MPEG2Source :</h3><br><ul>
	<code>
	MPEG2Source(str "d2v", int "cpu" int "idct" bool "iPP", int "moderate_h", int "moderate_v", bool "showQ", bool "fastMC", str "cpu2")<br>
	</code><br>
	<u>d2v</u> : <br>
	<ul>
	Your DVD2AVI project file. (*.d2v)
	</ul><br>
	<u>cpu</u> : 0 to 6.
	<ul>
	DivX decoder like cpu level setting.
	-	0 : No PP<br>
	- 1 : DEBLOCK_Y_H<br>
	- 2 : DEBLOCK_Y_H, DEBLOCK_Y_V<br>
	- 3 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H<br>
	- 4 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V<br>
	- 5 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V, DERING_Y<br>
	- 6 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V, DERING_Y, DERING_C<br>
  (Y=luma C=chroma, H=horizontal V=vertical)<br>
	default : 0
	</ul><br>
	<u>moderate_h, moderate_v</u> :
	<ul>
	Post Processing strength fine tunning.<br>
	smaller values are stronger. use with care.<br>
	default : moderate_h=20, moderate_v=40<br>
	</ul><br>
	<u>idct</u> : 1 to 5.
	<ul>
	iDCT : iDCT algo used.<br>
	0 : Default value (in .d2v file)<br>
	1 : 32 bit MMX<br>
	2 : 32 bit SSEMMX<br>
	3 : 64 bit FPU<br>
	4 : 64 bit IEEE-1180 Reference<br>
	5 : 32 bit SSE2 (for P4)<br>	
	6 : Skal's SSEMMX iDCT (fastest)<br>	
	7 : SimpleiDCT (Very accurate iDCT from XviD project)<br>	
	default : 0
	</ul><br>
	<u>iPP</u> :
	<ul>
	To use Field-Based Post-Processing.<br>
	it' better if you want to deinterlace<br>
	- True : Field based<br>
	- False : Image based (default)<br>
	</ul><br>
	<u>showQ</u> :
	<ul>
	To see the quantizers used for each MB.<br>
	a fun tool to play with ^^<br>
	default : false<br>
	</ul><br>
	<u>fastMC</u> :
	<ul>
	Vlad's Fast Motion Compensation code.<br>
	very small speedup, and degraded accuracy<br>
	it's here for testing purposes, and would probably be removed in next versions<br>
	for ssemmx capable cpu only.<br>
	default : false<br>
	</ul><br>
	<u>cpu2</u> :
	<ul>
	Custom cpu settings<br>
	you need to enter a 6 charachter string. each cross (x)<br>
	would enable the corresponding Post Processing feature :<br>
	<code><br>
	example :<br> 
	"oxoxox"<br>
	 123456<br>
	would enable chroma only PP<br>
	</code><br>
	1 : luma horizontal deblocking<br>
	2 : luma vertical deblocking<br>
	3 : chroma horizontal deblocking<br>
	4 : chroma vertical deblocking<br>
	5 : luma deringing<br>
	6 : chroma deringing<br>
	default : " " (disabled)<br>
	</ul><br>
	
	</ul><h3>LumaFilter :</h3><br><ul>
	<code>
	LumaFilter(clip, integer "lumoff", float "lumgain")<br>
	</code><br>
	the transfomation is : yy = (y*lumgain)+lumoff<br>
	<br>
	<u>lumoff</u> : <br>
	<ul>
	Luminosity offset.<br>
	default = -2 (for iago ^^)<br>
	</ul><br>
	<u>lumgain</u> : <br>
	<ul>
	Luminosity gain.<br>
	default = 1<br>
	</ul><br>
	</ul><h3>YV12toRGB24 :</h3><br><ul>
	<code>
  YV12toRGB24(clip, bool "interlaced" bool "TVscale")<br>
	</code><br>
	YV12->BGR24 convertion natively flips image<br>
	Use FilpVertical() after<br>
	<br>
	<u>interlaced</u> : <br>
	<ul>
	set this to true if your source is interlaced,<br>
	to interlace chroma correctly.<br>
	if you have a progressive stream, using false will<br>
	give sharper and real colors<br>
	default : true<br>
	</ul><br>
	<u>TVscale</u> : <br>
	<ul>
	The same setting as in DVD2AVI.<br>
	it may be inversed. try with and without and keep your favorite<br>
	default : false<br>
	</ul><br>
	</ul><h3>YV12toYUY2 :</h3><br><ul>
	<code>
	YV12toYUY2(clip, bool "interlaced")<br>
	</code><br>
	<u>interlaced</u> : <br>
	<ul>
	set this to true if your source is interlaced,<br>
	to interlace chroma correctly.<br>
	if you have a progressive stream, using false will<br>
	give sharper and real colors<br>
	default : true<br>
	</ul><br>
	<br>
	<u>tff</u> : <br>
	<ul>
	Top Field First.<br>
	set this to false if you have Bottom Field First.<br>
	default : true<br>
	</ul><br>
	<br>
	</ul><h3>BlindPP :</h3><br><ul>
	<code>
	BlindPP(clip, int "quant", int "cpu", str "cpu2", bool "iPP", int "moderate_h", int "moderate_v")<br>
	</code><br>
	To Deblock and Dering on any kind of DCT-encoded source.<br>
	Of course, less accurate than decoder intergrated PP, but still very efficient<br>
	need YV12 input.<br>
	<br>
	<u>quant</u> : <br>
	<ul>
	Emulated Quantizer<br>
	use higher value to increase aggressivity<br>
	using a value close to the source will allow very accurate postprocessing<br>
	default : 2<br>
	</ul><br>
	<u>cpu, cpu3, iPP, moderate_h, moderate_v</u> : <br>
	<ul>
	same settings as MPEG2Source's PP.
	defaults : cpu=6,cpu2="",iPP=false,moderate_h=20,moderate_v=40
	</ul><br>
	</ul>
	<br>
    <h2>History :</h2>
    <ul>
      <b>based on MPEG2Dec2 (save-oe CVS 28.09.2002)</b><br>
      <br>
      <u>betas versions (1 to 6)</u><br>
      <ul>
        - Added Nic's Post Processing with Field-Based PP<br>
        - Overrided iDCT / luma filtering choice<br>
        - Fixed Luma filtering MMX code (3 bugs at least)<br>
        - YV12-&gt;YUY2 Convertion optimised (+10 % speed)<br>
        - a PP bug fixed. a bit slower now.<br>
        - trbarry's SSE2 optimisation disabled.<br>
        - Added showQ debugging trigger<br>
        - Added vlad's new MC (3dnow/ssemmx) / re-writed ssemmx<br>
        - Added working MMX memory transfer for seeking (+3% speed)<br>
        - Added Interlaced Upsampling support<br>
      </ul>
      <br>
      <u>v 0.9 (09.11.02)</u>
      <ul>
        - heavy code cleaning<br>
        - redesigned the whole Avisynth interface<br>
        - YV12 support<br>
        - RGB24 support<br>
        - other misc stuff<br>
      </ul>
      <br>
      <u>v 0.91 (10.11.02)</u>
      <ul>
        - cleaned a bit more the source<br>
        - added MPEG2Dec3.def default settings loading (like don's filters)<br>
        - bff mode in SeparateFieldsYV12<br>
      </ul>
      <br>
      <u>v 0.92 (17.11.02)</u>
      <ul>
        - code released<br>
        - blindPP implemented<br>
      </ul>
      <br>
      <u>v 0.93 (25.11.02)</u>
      <ul>
        - total YV12 code convertion...<br>
        - ...who fixed YV12 bugs<br>
        - less memory is needed<br>
        - fast MMX copy (faster seeking)<br>
      </ul>
      <br>
      <u>v 0.94 (08.12.02)</u>
      <ul>
        - very little bugfix<br>
      </ul>
      <br>
      <u>v 1.00 (19.01.03)</u>
      <ul>
        - final version<br>
        - i squashed all bugs i were aware of<br>
      </ul>
      <br>
      <u>v 1.01 (unknown) - trbarry</u>
      <ul>
        Fixed HDTV bug (0x21 PID hardcoded)<br>
      </ul>
      <br>
      <u>v 1.02 (12.05.03) - Nic</u>
      <ul>
        aligned malloc done different<br>
      </ul>
      <br>
      <u>v 1.03 (12.05.03) - Nic</u>
      <ul>
        Now supports both DVD2AVI 1.77.3 D2V Files and 1.76 ones<br>
      </ul>
      <br>
      <u>v 1.04 (12.05.03) - Nic</u>
      <ul>
        Removed another memory leak, slightly quicker<br>
      </ul>
      <br>
      <u>v 1.05a (12.05.03) - trbarry</u>
      <ul>
        trbarry test version for optimisations<br>
      </ul>
      <br>
      <u>v 1.06 (24.05.03)</u>
      <ul>
        Nic: Added 2 new iDCT's Skal's (fastest!, idct=6) &amp; SimpleiDCT (very
        accurate, idct=7)<br>
        Nic: Support for external use of MPEG2Dec3.dll without AviSynth added
        back in<br>
        (See Source code for example.zip and GetPic example)<br>
        trbarry: Added new Add_Block optimisations as well as optimised Block
        Decoding for SSE2 machines<br>
        sh0dan: Uses AviSynth's fast BitBlt for mem copys where possible<br>
        Nic: General optimisations :) Faster now on all machines tested.<br>
      </ul>
      <br>
      <u>v 1.07 (6.06.03)</u>
      <ul>
        Nic &amp; Sh0dan: Bug Fixes, better stability on broken streams<br>
      </ul>
      <br>
      <u>v 1.08 (8.06.03)</u>
      <ul>
        trbarry: Optimised Simple_iDCT, lots faster now :)<br>
        Nic: added CPUCheck elsewhere, forgot to fix Lumafilter last time (Thanx
        ARDA!), robUx4 helped me make simple_idct into a fastcall
      </ul>
      <br>
      <u>v 1.09 (26.07.03)</u>
      <ul>
        Nic: Now skal's Sparse iDCT is used instead for idct=6 (fastest!)<br>
        Nic: Added the Luminance_Filter from DVD2AVI 1.77.3, for when
        Luminance_Filter is used in the .d2v<br>
      </ul>
      <br>
      <u>v 1.10 (28.07.03)</u>
      <ul>
        Nic: Damn! There was a problem with the Luminance filter and 1.77.3 D2V
        files. Fixed!
      </ul>
    </ul>
    <h2>Credits :</h2>
    <ul>
      Chia-chen Kuo, author of DVD2AVI<br>
      Peter Gubanov, author of the MMX/SSEMMX iDCT<br>
      Dmitry Rozhdestvensky, author of the SSE2 iDCT<br>
      Miha Peternel, author of the Floating Point and Reference iDCT<br>
      Mathias Born, author of MPEG2Dec<br>
      <br>
      Special thanks to Nic, for the Post Processing who made MPEG2Dec3 possible<br>
    </ul>
    <ul>
      1.01 and above: Nic, trbarry, sh0dan<br>
      Thanks to Skal for the use of his iDCT (http://skal.planet-d.net)
    </ul>
</ul>
</body>
</html>